package com.googlecode.yoohoo.io.socket.stream;

public enum NegotiationPhase {
	INITIAL_STREAM {
		public NegotiationPhase next() {
			return AFTER_INITIAL_STREAM;
		}
		
		public String toString() {
			return PHASE_INITIAL_STREAM_STRING;
		}
	},
	AFTER_INITIAL_STREAM {
		public NegotiationPhase next() {
			return TLS;
		}
		
		public String toString() {
			return PHASE_AFTER_INITIAL_STREAM_STRING;
		}
	},
	TLS {
		public NegotiationPhase next() {
			return AFTER_TLS;
		}
		
		public String toString() {
			return PHASE_TLS_STRING;
		}
	},
	AFTER_TLS {
		public NegotiationPhase next() {
			return SASL;
		}
		
		public String toString() {
			return PHASE_AFTER_TLS_STRING;
		}
	},
	SASL {
		public NegotiationPhase next() {
			return RESOURCE_BINDING;
		}
		
		public String toString() {
			return PHASE_SASL_STRING;
		}
	},
	RESOURCE_BINDING {
		public NegotiationPhase next() {
			return SESSION_ESTABLISHMENT;
		}
		
		public String toString() {
			return PHASE_RESOURCE_BINDING_STRING;
		}
	},
	SESSION_ESTABLISHMENT {
		public NegotiationPhase next() {
			return null;
		}
		
		public String toString() {
			return PHASE_SESSION_ESTABLISHMENT_STRING;
		}
	};
	
	private static final String PHASE_INITIAL_STREAM_STRING = "InitialStream";
	private static final String PHASE_AFTER_INITIAL_STREAM_STRING = "AfterInitialStream";
	private static final String PHASE_TLS_STRING = "TLS";
	private static final String PHASE_AFTER_TLS_STRING = "AfterTLS";
	private static final String PHASE_SASL_STRING = "SASL";
	private static final String PHASE_RESOURCE_BINDING_STRING = "ResourceBinding";
	private static final String PHASE_SESSION_ESTABLISHMENT_STRING = "SessionEstablishment";

	public abstract NegotiationPhase next();
}
